package com.hjq.fcloud.jump;

import android.text.TextUtils;

import java.io.Serializable;

public class CommonJumpBean implements Serializable {
    //跳转详情需要的id
    private String bizId;
    //区分跳转详情
    private String bizCode;
    //是否能签字，true签字，false查看详情
    private boolean startSign;

    //来自二维码扫描,默认false
    private boolean fromScanQrCode;

    public boolean isFromScanQrCode() {
        return fromScanQrCode;
    }

    public void setFromScanQrCode(boolean fromScanQrCode) {
        this.fromScanQrCode = fromScanQrCode;
    }

    public String getBizId() {
        return bizId;
    }

    public void setBizId(String bizId) {
        this.bizId = bizId;
    }

    public void setBizCode(String bizCode) {
        this.bizCode = bizCode;
    }

    public boolean isStartSign() {
        return startSign;
    }

    public void setStartSign(boolean startSign) {
        this.startSign = startSign;
    }

    //============== 方法处理 =============
    public String getOriginalBizCode() {
        return bizCode;
    }

    public String getBizCode() {
        return parseBizCode(bizCode);
    }

    public static String parseBizCode(String bizCode) {
        String SPLIT = CommonJump.MAKRER_SPLIT;
        if(!TextUtils.isEmpty(bizCode) && bizCode.startsWith(SPLIT)){
            String[] array = bizCode.split(SPLIT);
            if(array != null && array.length == 2){
                return array[1];
            }
        }
        return bizCode;
    }
}
